Importing data for Electric Vehicle Popultion Size History

library(readr)
Electric_Vehicle_Population_Size_History <- read_csv("~/Documents/Fall 2023 - Business Forecasting/Datasets/Electric_Vehicle_Population_Size_History.csv")
## Rows: 80 Columns: 4
## ── Column specification ────────────────────────────────────────────────────────
## Delimiter: ","
## chr (1): Date
## dbl (3): Plug-In Hybrid Electric Vehicle (PHEV) Count, Battery Electric Vehi...
## 
## ℹ Use `spec()` to retrieve the full column specification for this data.
## ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
View(Electric_Vehicle_Population_Size_History)

Creating a time series for Electric Vehicle (EV) Total

library(fpp)
## Loading required package: forecast
## Registered S3 method overwritten by 'quantmod':
##   method            from
##   as.zoo.data.frame zoo
## Loading required package: fma
## Loading required package: expsmooth
## Loading required package: lmtest
## Loading required package: zoo
## 
## Attaching package: 'zoo'
## The following objects are masked from 'package:base':
## 
##     as.Date, as.Date.numeric
## Loading required package: tseries
library(fpp2)
## ── Attaching packages ────────────────────────────────────────────── fpp2 2.5 ──
## ✔ ggplot2 3.4.4
## 
## 
## Attaching package: 'fpp2'
## The following objects are masked from 'package:fpp':
## 
##     ausair, ausbeer, austa, austourists, debitcards, departures,
##     elecequip, euretail, guinearice, oil, sunspotarea, usmelec
library(TTR)

Electric_Vehicle_Population_Total_ts <- ts(Electric_Vehicle_Population_Size_History$`Electric Vehicle (EV) Total`, frequency = 12, start = c(2017,1))
Electric_Vehicle_Population_Total_ts
##         Jan    Feb    Mar    Apr    May    Jun    Jul    Aug    Sep    Oct
## 2017  22425  23094  23688  24390  25066  25737  26310  26825  27452  28173
## 2018  30267  30809  31573  32438  33634  34790  35633  36540  37454  39159
## 2019  43837  44579  45068  46344  47305  48385  49630  50583  51581  53436
## 2020  57137  57731  58606  58910  58915  59277  60813  61558  62338  63610
## 2021  68130  69286  70467  72790  74437  76145  78598  80537  82064  84200
## 2022  89954  91856  93908  96667  98524 100720 103480 106249 108061 111690
## 2023 121935 124930 128097 132365 136579 140832 144810 150482              
##         Nov    Dec
## 2017  28765  29305
## 2018  40801  42065
## 2019  54060  54883
## 2020  65142  66230
## 2021  86245  88027
## 2022 115343 118127
## 2023
attributes (Electric_Vehicle_Population_Total_ts)
## $tsp
## [1] 2017.000 2023.583   12.000
## 
## $class
## [1] "ts"
plot(Electric_Vehicle_Population_Total_ts)

Acf(Electric_Vehicle_Population_Total_ts)

Forecasting Models

Average Model

The Average Model takes the average of all historical points. The plot shows that the avearge of the total registration of electric vehicles in the State of Washington is 66,273.58. This model will take this average to forecast for the next 24 months, which is the blue straight line in the plot. The shaded area shows the confidence interval that the future values may lie between this area. As we can see from the plot, this is not a good forecasting model for this data based on the trend since the forecasted values are way below the current trend.

mean_forecast <- meanf(Electric_Vehicle_Population_Total_ts, 24)
plot(mean_forecast)

Acf(mean_forecast$residuals)

attributes(mean_forecast)
## $names
##  [1] "method"    "level"     "x"         "series"    "mean"      "lower"    
##  [7] "upper"     "model"     "lambda"    "fitted"    "residuals"
## 
## $class
## [1] "forecast"
summary(mean_forecast)
## 
## Forecast method: Mean
## 
## Model Information:
## $mu
## [1] 66273.58
## 
## $mu.se
## [1] 3832.713
## 
## $sd
## [1] 34280.83
## 
## $bootstrap
## [1] FALSE
## 
## $call
## meanf(y = Electric_Vehicle_Population_Total_ts, h = 24)
## 
## attr(,"class")
## [1] "meanf"
## 
## Error measures:
##                        ME    RMSE      MAE       MPE     MAPE     MASE
## Training set 7.275958e-12 34065.9 28119.51 -31.24979 56.11059 1.564725
##                   ACF1
## Training set 0.9498006
## 
## Forecasts:
##          Point Forecast    Lo 80    Hi 80     Lo 95  Hi 95
## Sep 2023       66273.58 21694.38 110852.8 -2385.846 134933
## Oct 2023       66273.58 21694.38 110852.8 -2385.846 134933
## Nov 2023       66273.58 21694.38 110852.8 -2385.846 134933
## Dec 2023       66273.58 21694.38 110852.8 -2385.846 134933
## Jan 2024       66273.58 21694.38 110852.8 -2385.846 134933
## Feb 2024       66273.58 21694.38 110852.8 -2385.846 134933
## Mar 2024       66273.58 21694.38 110852.8 -2385.846 134933
## Apr 2024       66273.58 21694.38 110852.8 -2385.846 134933
## May 2024       66273.58 21694.38 110852.8 -2385.846 134933
## Jun 2024       66273.58 21694.38 110852.8 -2385.846 134933
## Jul 2024       66273.58 21694.38 110852.8 -2385.846 134933
## Aug 2024       66273.58 21694.38 110852.8 -2385.846 134933
## Sep 2024       66273.58 21694.38 110852.8 -2385.846 134933
## Oct 2024       66273.58 21694.38 110852.8 -2385.846 134933
## Nov 2024       66273.58 21694.38 110852.8 -2385.846 134933
## Dec 2024       66273.58 21694.38 110852.8 -2385.846 134933
## Jan 2025       66273.58 21694.38 110852.8 -2385.846 134933
## Feb 2025       66273.58 21694.38 110852.8 -2385.846 134933
## Mar 2025       66273.58 21694.38 110852.8 -2385.846 134933
## Apr 2025       66273.58 21694.38 110852.8 -2385.846 134933
## May 2025       66273.58 21694.38 110852.8 -2385.846 134933
## Jun 2025       66273.58 21694.38 110852.8 -2385.846 134933
## Jul 2025       66273.58 21694.38 110852.8 -2385.846 134933
## Aug 2025       66273.58 21694.38 110852.8 -2385.846 134933

Naive Model

The Naive Model takes the last month’s data to forecast for the next 24 months as shown in the blue straight line in the plot. The confidence interval shows the future values may lie within this shaded area based on this prediction. This forecasting model does not appear to be a good model based on the trend.

naive_forecast <- naive(Electric_Vehicle_Population_Total_ts, 24)
plot(naive_forecast)

Acf(naive_forecast$residuals)

summary(naive_forecast)
## 
## Forecast method: Naive method
## 
## Model Information:
## Call: naive(y = Electric_Vehicle_Population_Total_ts, h = 24) 
## 
## Residual sd: 1971.8019 
## 
## Error measures:
##                    ME     RMSE      MAE      MPE     MAPE       MASE      ACF1
## Training set 1620.975 1971.802 1620.975 2.377577 2.377577 0.09019999 0.7573396
## 
## Forecasts:
##          Point Forecast    Lo 80    Hi 80    Lo 95    Hi 95
## Sep 2023         150482 147955.0 153009.0 146617.3 154346.7
## Oct 2023         150482 146908.3 154055.7 145016.5 155947.5
## Nov 2023         150482 146105.2 154858.8 143788.2 157175.8
## Dec 2023         150482 145428.1 155535.9 142752.7 158211.3
## Jan 2024         150482 144831.5 156132.5 141840.4 159123.6
## Feb 2024         150482 144292.2 156671.8 141015.6 159948.4
## Mar 2024         150482 143796.3 157167.7 140257.1 160706.9
## Apr 2024         150482 143334.7 157629.3 139551.1 161412.9
## May 2024         150482 142901.1 158062.9 138888.0 162076.0
## Jun 2024         150482 142491.0 158473.0 138260.9 162703.1
## Jul 2024         150482 142101.0 158863.0 137664.4 163299.6
## Aug 2024         150482 141728.3 159235.7 137094.4 163869.6
## Sep 2024         150482 141370.9 159593.1 136547.8 164416.2
## Oct 2024         150482 141027.0 159937.0 136021.8 164942.2
## Nov 2024         150482 140695.1 160268.9 135514.2 165449.8
## Dec 2024         150482 140374.1 160589.9 135023.4 165940.6
## Jan 2025         150482 140063.1 160900.9 134547.6 166416.4
## Feb 2025         150482 139761.0 161203.0 134085.6 166878.4
## Mar 2025         150482 139467.2 161496.8 133636.3 167327.7
## Apr 2025         150482 139181.1 161782.9 133198.7 167765.3
## May 2025         150482 138902.0 162062.0 132771.9 168192.1
## Jun 2025         150482 138629.5 162334.5 132355.1 168608.9
## Jul 2025         150482 138363.1 162600.9 131947.7 169016.3
## Aug 2025         150482 138102.4 162861.6 131549.1 169414.9

Random Walk Forecast (RWF)

Similar to the Naive Model, the Random Walk Forecast Model also takes the last month’s data to forecast for the values in the next 24 months with the same values for the confidence interval. Again, it is not considered a good forecasting model based on the trend.

rwf_forecast <- rwf(Electric_Vehicle_Population_Total_ts,24)
plot(rwf_forecast)

Acf(rwf_forecast$residuals)

summary(rwf_forecast)
## 
## Forecast method: Random walk
## 
## Model Information:
## Call: rwf(y = Electric_Vehicle_Population_Total_ts, h = 24) 
## 
## Residual sd: 1971.8019 
## 
## Error measures:
##                    ME     RMSE      MAE      MPE     MAPE       MASE      ACF1
## Training set 1620.975 1971.802 1620.975 2.377577 2.377577 0.09019999 0.7573396
## 
## Forecasts:
##          Point Forecast    Lo 80    Hi 80    Lo 95    Hi 95
## Sep 2023         150482 147955.0 153009.0 146617.3 154346.7
## Oct 2023         150482 146908.3 154055.7 145016.5 155947.5
## Nov 2023         150482 146105.2 154858.8 143788.2 157175.8
## Dec 2023         150482 145428.1 155535.9 142752.7 158211.3
## Jan 2024         150482 144831.5 156132.5 141840.4 159123.6
## Feb 2024         150482 144292.2 156671.8 141015.6 159948.4
## Mar 2024         150482 143796.3 157167.7 140257.1 160706.9
## Apr 2024         150482 143334.7 157629.3 139551.1 161412.9
## May 2024         150482 142901.1 158062.9 138888.0 162076.0
## Jun 2024         150482 142491.0 158473.0 138260.9 162703.1
## Jul 2024         150482 142101.0 158863.0 137664.4 163299.6
## Aug 2024         150482 141728.3 159235.7 137094.4 163869.6
## Sep 2024         150482 141370.9 159593.1 136547.8 164416.2
## Oct 2024         150482 141027.0 159937.0 136021.8 164942.2
## Nov 2024         150482 140695.1 160268.9 135514.2 165449.8
## Dec 2024         150482 140374.1 160589.9 135023.4 165940.6
## Jan 2025         150482 140063.1 160900.9 134547.6 166416.4
## Feb 2025         150482 139761.0 161203.0 134085.6 166878.4
## Mar 2025         150482 139467.2 161496.8 133636.3 167327.7
## Apr 2025         150482 139181.1 161782.9 133198.7 167765.3
## May 2025         150482 138902.0 162062.0 132771.9 168192.1
## Jun 2025         150482 138629.5 162334.5 132355.1 168608.9
## Jul 2025         150482 138363.1 162600.9 131947.7 169016.3
## Aug 2025         150482 138102.4 162861.6 131549.1 169414.9

A drift with RWF

The Random Walk Forecast Model with a drift shows an upward trend for the next 24 months. The confidence interval also has an increased values as opposed to the Random Walk Forecast Model. This shows a better forecast based on the trend of the time series.

rwf_forecast_drift <- rwf(Electric_Vehicle_Population_Total_ts,24, drift=TRUE)
plot(rwf_forecast_drift)

Acf(rwf_forecast_drift$residuals)

summary(rwf_forecast_drift)
## 
## Forecast method: Random walk with drift
## 
## Model Information:
## Call: rwf(y = Electric_Vehicle_Population_Total_ts, h = 24, drift = TRUE) 
## 
## Drift: 1620.9747  (se 127.1202)
## Residual sd: 1129.8687 
## 
## Error measures:
##                         ME     RMSE      MAE        MPE     MAPE       MASE
## Training set -1.842015e-13 1122.695 873.4901 -0.7817773 1.556505 0.04860582
##                   ACF1
## Training set 0.7573396
## 
## Forecasts:
##          Point Forecast    Lo 80    Hi 80    Lo 95    Hi 95
## Sep 2023       152103.0 150645.9 153560.1 149874.5 154331.4
## Oct 2023       153723.9 151650.4 155797.5 150552.8 156895.1
## Nov 2023       155344.9 152789.8 157900.1 151437.1 159252.7
## Dec 2023       156965.9 153997.5 159934.3 152426.2 161505.6
## Jan 2024       158586.9 155248.2 161925.6 153480.8 163692.9
## Feb 2024       160207.8 156528.8 163886.9 154581.2 165834.5
## Mar 2024       161828.8 157831.7 165826.0 155715.7 167941.9
## Apr 2024       163449.8 159151.9 167747.7 156876.7 170022.9
## May 2024       165070.8 160486.0 169655.5 158059.0 172082.5
## Jun 2024       166691.7 161831.6 171551.9 159258.9 174124.6
## Jul 2024       168312.7 163186.8 173438.6 160473.4 176152.1
## Aug 2024       169933.7 164550.2 175317.2 161700.4 178167.0
## Sep 2024       171554.7 165920.7 177188.7 162938.2 180171.1
## Oct 2024       173175.6 167297.3 179054.0 164185.5 182165.8
## Nov 2024       174796.6 168679.3 180913.9 165441.0 184152.2
## Dec 2024       176417.6 170066.2 182769.0 166703.9 186131.3
## Jan 2025       178038.6 171457.3 184619.9 167973.4 188103.8
## Feb 2025       179659.5 172852.3 186466.8 169248.7 190070.4
## Mar 2025       181280.5 174250.8 188310.3 170529.4 192031.6
## Apr 2025       182901.5 175652.4 190150.6 171815.0 193988.0
## May 2025       184522.5 177056.9 191988.0 173104.9 195940.0
## Jun 2025       186143.4 178464.1 193822.8 174398.9 197887.9
## Jul 2025       187764.4 179873.7 195655.1 175696.7 199832.2
## Aug 2025       189385.4 181285.6 197485.2 176997.8 201773.0

Seasonal Naive

The time series shows an upward trend and does not show any seasonality trend. Therefore, the Seasnoal Naive Model is not a good model. Based on the plot, it appears that it takes the upward trend from the recent months then a downward trend, then a similar upward trend again to forecast the values for the next 24 months. This model does not represent the increasing upward trend of the time series.

snaive_forecast <- snaive(Electric_Vehicle_Population_Total_ts,24)
plot(snaive_forecast)

Acf(snaive_forecast$residuals)

summary(snaive_forecast)
## 
## Forecast method: Seasonal naive method
## 
## Model Information:
## Call: snaive(y = Electric_Vehicle_Population_Total_ts, h = 24) 
## 
## Residual sd: 20142.9651 
## 
## Error measures:
##                   ME     RMSE     MAE      MPE     MAPE MASE      ACF1
## Training set 17970.9 20142.97 17970.9 24.40798 24.40798    1 0.9243048
## 
## Forecasts:
##          Point Forecast     Lo 80    Hi 80     Lo 95    Hi 95
## Sep 2023         108061  82246.75 133875.2  68581.51 147540.5
## Oct 2023         111690  85875.75 137504.2  72210.51 151169.5
## Nov 2023         115343  89528.75 141157.2  75863.51 154822.5
## Dec 2023         118127  92312.75 143941.2  78647.51 157606.5
## Jan 2024         121935  96120.75 147749.2  82455.51 161414.5
## Feb 2024         124930  99115.75 150744.2  85450.51 164409.5
## Mar 2024         128097 102282.75 153911.2  88617.51 167576.5
## Apr 2024         132365 106550.75 158179.2  92885.51 171844.5
## May 2024         136579 110764.75 162393.2  97099.51 176058.5
## Jun 2024         140832 115017.75 166646.2 101352.51 180311.5
## Jul 2024         144810 118995.75 170624.2 105330.51 184289.5
## Aug 2024         150482 124667.75 176296.2 111002.51 189961.5
## Sep 2024         108061  71554.14 144567.9  52228.58 163893.4
## Oct 2024         111690  75183.14 148196.9  55857.58 167522.4
## Nov 2024         115343  78836.14 151849.9  59510.58 171175.4
## Dec 2024         118127  81620.14 154633.9  62294.58 173959.4
## Jan 2025         121935  85428.14 158441.9  66102.58 177767.4
## Feb 2025         124930  88423.14 161436.9  69097.58 180762.4
## Mar 2025         128097  91590.14 164603.9  72264.58 183929.4
## Apr 2025         132365  95858.14 168871.9  76532.58 188197.4
## May 2025         136579 100072.14 173085.9  80746.58 192411.4
## Jun 2025         140832 104325.14 177338.9  84999.58 196664.4
## Jul 2025         144810 108303.14 181316.9  88977.58 200642.4
## Aug 2025         150482 113975.14 186988.9  94649.58 206314.4

Moving Averages

Moving average with order of 3

Based on the ACF, it shows that the recent data are more significant than the historical data. Therefore, the lower order moving average model provides a better forecast than higher order moving average model since the larger weight is given to the more recent period.

MA3_forecast <- ma(Electric_Vehicle_Population_Total_ts,order=3)
plot(MA3_forecast)

Moving average with order of 6

The moving average model with order of 6 still provides a good forecast for the upward trend although it smooths out the data more than the previous model with order of 3. It gives more weight to more historical data which appears to be less significant. This is not as good as the previous model with the lower order.

MA6_forecast <- ma(Electric_Vehicle_Population_Total_ts,order=6)
plot(MA6_forecast)

Moving average with order of 12

The larger order of the moving average model, the smoother effect on the plot. As we can see from the plot, it gives more weight to more historical data as comparing to the moving average model with order of 3 and 6. Therefore, it is not as good as the previous two models with the lower order.

MA12_forecast <- ma(Electric_Vehicle_Population_Total_ts,order=12)
plot(MA12_forecast)

Moving average with order of 18

As mentioned above, the larger order of moving average puts more weight on more historical data. Therefore, the moving average with large order does not represent well for this time series.

MA18_forecast <- ma(Electric_Vehicle_Population_Total_ts,order=18)
plot(MA18_forecast)

Exponential

ets_forecast <- ets(Electric_Vehicle_Population_Total_ts)
plot(ets_forecast)

Holtwinters

The Holtwinters Model without any smoothing constants provides a pretty good fit to the original data plot. The residuls are very small based on the comparison of the actual and forecasted data (black line vs red line).

HW_forecast <- HoltWinters(Electric_Vehicle_Population_Total_ts)
plot(HW_forecast)
attributes(HW_forecast)
## $names
## [1] "fitted"       "x"            "alpha"        "beta"         "gamma"       
## [6] "coefficients" "seasonal"     "SSE"          "call"        
## 
## $class
## [1] "HoltWinters"
summary(HW_forecast)
##              Length Class  Mode     
## fitted       272    mts    numeric  
## x             80    ts     numeric  
## alpha          1    -none- numeric  
## beta           1    -none- numeric  
## gamma          1    -none- numeric  
## coefficients  14    -none- numeric  
## seasonal       1    -none- character
## SSE            1    -none- numeric  
## call           2    -none- call
plot(HW_forecast)

The Holtwinters Model with exponential smoothing for trend and non-seasonal model provides a decent fit. However, the residual are greater than the previous model with no smoothing constants.

SSE_Simple <- HoltWinters(Electric_Vehicle_Population_Total_ts,beta=FALSE,gamma=FALSE)
attributes(SSE_Simple)
## $names
## [1] "fitted"       "x"            "alpha"        "beta"         "gamma"       
## [6] "coefficients" "seasonal"     "SSE"          "call"        
## 
## $class
## [1] "HoltWinters"
plot(SSE_Simple)

SSE_Simple$SSE
## [1] 307178580
head(SSE_Simple$fitted)
##              xhat    level
## Feb 2017 22425.00 22425.00
## Mar 2017 23093.97 23093.97
## Apr 2017 23687.97 23687.97
## May 2017 24389.97 24389.97
## Jun 2017 25065.97 25065.97
## Jul 2017 25736.97 25736.97

The Holtwinters Model with non-exponential smoothing for trend and non-seasonal model provides a pretty nice fit and the residuals are small among the acutal and forecasted data.

SSE_Simple_1 <- HoltWinters(Electric_Vehicle_Population_Total_ts,beta=TRUE,gamma=FALSE)
attributes(SSE_Simple_1)
## $names
## [1] "fitted"       "x"            "alpha"        "beta"         "gamma"       
## [6] "coefficients" "seasonal"     "SSE"          "call"        
## 
## $class
## [1] "HoltWinters"
plot(SSE_Simple_1)

SSE_Simple_1$SSE
## [1] 22118991
head(SSE_Simple_1$fitted)
##              xhat    level    trend
## Mar 2017 23763.00 23094.00 669.0000
## Apr 2017 24342.79 23718.40 624.3968
## May 2017 25023.34 24370.87 652.4709
## Jun 2017 25726.55 25048.71 677.8421
## Jul 2017 26416.82 25732.77 684.0557
## Aug 2017 26973.82 26353.29 620.5281

The Holtwinters Model with non-exponential smoothing for trend and seasonal model also provides a pretty nice fit and the residuals are small among the acutal and forecasted data.

SSE_Simple_2 <- HoltWinters(Electric_Vehicle_Population_Total_ts,beta=TRUE,gamma=TRUE)
attributes(SSE_Simple_2)
## $names
## [1] "fitted"       "x"            "alpha"        "beta"         "gamma"       
## [6] "coefficients" "seasonal"     "SSE"          "call"        
## 
## $class
## [1] "HoltWinters"
plot(SSE_Simple_2)

SSE_Simple_2$SSE
## [1] 56839993
head(SSE_Simple_2$fitted)
##              xhat    level     trend     season
## Jan 2018 26034.51 25199.69  775.1234   59.69792
## Feb 2018 34283.26 29837.25 4637.5633 -191.55208
## Mar 2018 32522.28 31304.31 1467.0597 -249.09375
## Apr 2018 32247.28 31905.09  600.7795 -258.59375
## May 2018 33432.90 32679.92  774.8285  -21.84375
## Jun 2018 34697.59 33638.26  958.3431  100.98958

The Holtwinters Model with exponential smoothing for trend and seasonal model provides quite similar forecast with the exponential smoothing for trend and non-seaonal model. In both models, the residuals are greater than the other Holtwinters models displayed above.

SSE_Simple_3 <- HoltWinters(Electric_Vehicle_Population_Total_ts,beta=FALSE,gamma=TRUE)
attributes(SSE_Simple_3)
## $names
## [1] "fitted"       "x"            "alpha"        "beta"         "gamma"       
## [6] "coefficients" "seasonal"     "SSE"          "call"        
## 
## $class
## [1] "HoltWinters"
plot(SSE_Simple_3)

SSE_Simple_3$SSE
## [1] 325250864
head(SSE_Simple_2$fitted)
##              xhat    level     trend     season
## Jan 2018 26034.51 25199.69  775.1234   59.69792
## Feb 2018 34283.26 29837.25 4637.5633 -191.55208
## Mar 2018 32522.28 31304.31 1467.0597 -249.09375
## Apr 2018 32247.28 31905.09  600.7795 -258.59375
## May 2018 33432.90 32679.92  774.8285  -21.84375
## Jun 2018 34697.59 33638.26  958.3431  100.98958

Plot all in a single chart

plot(mean_forecast, col="black")
lines(naive_forecast$mean,col="red")
lines(rwf_forecast$mean, col="green")
lines(rwf_forecast_drift$mean, col="hotpink")
lines(snaive_forecast$mean, col="blue")
lines(MA6_forecast, col="purple")
lines(MA12_forecast, col="orange")
lines(MA18_forecast, col="yellow")

Decomposition

ets_forecast <- ets(Electric_Vehicle_Population_Total_ts)
plot(ets_forecast)

attributes(ets_forecast)
## $names
##  [1] "loglik"     "aic"        "bic"        "aicc"       "mse"       
##  [6] "amse"       "fit"        "residuals"  "fitted"     "states"    
## [11] "par"        "m"          "method"     "series"     "components"
## [16] "call"       "initstate"  "sigma2"     "x"         
## 
## $class
## [1] "ets"
ets_forecast$mse
## [1] 275304.6

Accuracy measures for different forecasting models

I pick the Mean Absolute Percentage Error (MAPE) as the accuracy measure for this time series. By comparing the MAPE with different models listed below, the Moving Average with order of 3 shows the least MAPE. This indicates that the Moving Average with order of 3 is the best model based on the accuracy comparison.

library(forecast)

Average Model

accuracy(mean_forecast)
##                        ME    RMSE      MAE       MPE     MAPE     MASE
## Training set 7.275958e-12 34065.9 28119.51 -31.24979 56.11059 1.564725
##                   ACF1
## Training set 0.9498006

Naive Model

accuracy(naive_forecast)
##                    ME     RMSE      MAE      MPE     MAPE       MASE      ACF1
## Training set 1620.975 1971.802 1620.975 2.377577 2.377577 0.09019999 0.7573396

Random Walk Forecast Model

accuracy(rwf_forecast)
##                    ME     RMSE      MAE      MPE     MAPE       MASE      ACF1
## Training set 1620.975 1971.802 1620.975 2.377577 2.377577 0.09019999 0.7573396

Random Walk Forecast with a Drift Model

accuracy(rwf_forecast_drift)
##                         ME     RMSE      MAE        MPE     MAPE       MASE
## Training set -1.842015e-13 1122.695 873.4901 -0.7817773 1.556505 0.04860582
##                   ACF1
## Training set 0.7573396

Seasonal Naive Model

accuracy(snaive_forecast)
##                   ME     RMSE     MAE      MPE     MAPE MASE      ACF1
## Training set 17970.9 20142.97 17970.9 24.40798 24.40798    1 0.9243048

Moving Averages with different orders (3, 6, 12 and 18)

accuracy(MA3_forecast,Electric_Vehicle_Population_Total_ts, h=24)
##                 ME     RMSE     MAE         MPE      MAPE      ACF1 Theil's U
## Test set -21.38034 210.1715 150.765 -0.02526429 0.2403089 -0.414049 0.1283632
accuracy(MA6_forecast,Electric_Vehicle_Population_Total_ts, h=24)
##                 ME     RMSE      MAE        MPE      MAPE      ACF1 Theil's U
## Test set -76.85473 308.7977 232.2872 -0.1015902 0.3866858 0.1726912 0.1968508
accuracy(MA12_forecast,Electric_Vehicle_Population_Total_ts, h=24)
##                 ME     RMSE      MAE        MPE      MAPE      ACF1 Theil's U
## Test set -267.8989 575.2414 459.6562 -0.3930565 0.7614215 0.6495116 0.3453847
accuracy(MA18_forecast,Electric_Vehicle_Population_Total_ts, h=24)
##                 ME     RMSE      MAE        MPE     MAPE      ACF1 Theil's U
## Test set -566.4534 997.2238 827.0959 -0.8592732 1.360718 0.8454964 0.5512701

Seasonal Decomposition of Time Series by Loess

stl_decomp <- stl(Electric_Vehicle_Population_Total_ts, s.window = "periodic")
plot(stl_decomp)

attributes (stl_decomp)
## $names
## [1] "time.series" "weights"     "call"        "win"         "deg"        
## [6] "jump"        "inner"       "outer"      
## 
## $class
## [1] "stl"
stl_decomp$weights
##  [1] 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
## [39] 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
## [77] 1 1 1 1
stl_decomp$call
## stl(x = Electric_Vehicle_Population_Total_ts, s.window = "periodic")
stl_decomp$win
##   s   t   l 
## 801  19  13
stl_decomp$deg
## s t l 
## 0 1 1
stl_decomp$jump
##  s  t  l 
## 81  2  2
stl_decomp$inner
## [1] 2
stl_decomp$outer
## [1] 0

Seasonal adjustment

tmp <- seasadj(stl_decomp)
plot(Electric_Vehicle_Population_Total_ts, col="black")
lines(tmp, col="red")

Forecast of Seasonal Decomposition of Time Series by Loess

f_stl <- forecast(stl_decomp)
f_stl <- forecast(stl_decomp, h=24)
plot(f_stl)

accuracy(f_stl)
##                    ME     RMSE      MAE       MPE      MAPE       MASE
## Training set 98.78592 537.7358 378.9391 0.1096643 0.6958745 0.02108627
##                     ACF1
## Training set -0.02587675
attributes(f_stl)
## $names
##  [1] "model"     "mean"      "level"     "x"         "upper"     "lower"    
##  [7] "fitted"    "method"    "series"    "residuals"
## 
## $class
## [1] "forecast"
Acf(f_stl$residuals)

Classical Seasonal Decomposition by Moving Averages

decomp_ev <- decompose(Electric_Vehicle_Population_Total_ts)
plot(decomp_ev)

attributes (decomp_ev)
## $names
## [1] "x"        "seasonal" "trend"    "random"   "figure"   "type"    
## 
## $class
## [1] "decomposed.ts"

Classical Seasonal Decomposition by Moving Averages - Multiplicative

decomp_evm <- decompose(Electric_Vehicle_Population_Total_ts, type="multiplicative")
plot(decomp_evm)

attributes (decomp_evm)
## $names
## [1] "x"        "seasonal" "trend"    "random"   "figure"   "type"    
## 
## $class
## [1] "decomposed.ts"

Forecast of Classical Seasonal Decomposition by Moving Averages

By using two different seasonal decomposition methods, the forecasting accuracy measure for Classical Seasonal Decomposition by Moving Averages has lower MAPE. The ACF plot for residuals also looks better for Classical Seasonal Decomposition by Moving Averages as the lines are all within the blue dash lines on the plot.

f_decomp <- forecast(seasadj(decomp_ev), h=24)
plot(f_decomp)

accuracy(f_decomp)
##                    ME     RMSE      MAE        MPE      MAPE       MASE
## Training set 97.10534 438.1027 329.2923 0.09248334 0.5842102 0.01832364
##                     ACF1
## Training set -0.01195674
Acf(f_decomp$residuals)

ARIMA Model

ADF test

The p-value for ADF test is 0.99 which is greater than 0.05. This indicates that the differencing is required based on ADF test.

adf.test(Electric_Vehicle_Population_Total_ts)
## Warning in adf.test(Electric_Vehicle_Population_Total_ts): p-value greater than
## printed p-value
## 
##  Augmented Dickey-Fuller Test
## 
## data:  Electric_Vehicle_Population_Total_ts
## Dickey-Fuller = 2.9404, Lag order = 4, p-value = 0.99
## alternative hypothesis: stationary

Kipps test

The p-value for Kipps test is 0.01 which is less than 0.05. This indicates that the differencing is required based on Kipps test.

kpss.test(Electric_Vehicle_Population_Total_ts)
## Warning in kpss.test(Electric_Vehicle_Population_Total_ts): p-value smaller
## than printed p-value
## 
##  KPSS Test for Level Stationarity
## 
## data:  Electric_Vehicle_Population_Total_ts
## KPSS Level = 1.986, Truncation lag parameter = 3, p-value = 0.01

NSDIFFS for seasonal data

NSDIFFS works for seasonal data. Since this time series doesn’t show any seasonality, therefore, the result turns out to be 0 based on NSDIFFS function.

nsdiffs(Electric_Vehicle_Population_Total_ts)
## [1] 0

NDIFFS for non-seasonal data

NDIFFS function shows that this time series requires 2 differences to become stationary.

ndiffs(Electric_Vehicle_Population_Total_ts)
## [1] 2

tsdisplay plots ACF, PACF and timeseries plot together

tsdisplay(Electric_Vehicle_Population_Total_ts)

Take first order differences as indiciated by NDIFFS function

Electric_Vehicle_Population_Total_ts_diff1 <- diff(Electric_Vehicle_Population_Total_ts, differences = 1)

See if more differences is needed and how plots look

Take second order differences as indicated by NDIFFS function

Based on the 2nd order of differencing, the time series is now stationary. The ACF has positive and negative values which implies the change of direction of the time series. The PACF still shows that the first and second lags are signification. The values for P may fall within 1 or 2.

Electric_Vehicle_Population_Total_ts_diff2 <- diff(Electric_Vehicle_Population_Total_ts, differences = 2)
tsdisplay(Electric_Vehicle_Population_Total_ts_diff2)

ndiffs(Electric_Vehicle_Population_Total_ts_diff2)
## [1] 0
kpss.test(Electric_Vehicle_Population_Total_ts_diff2)
## Warning in kpss.test(Electric_Vehicle_Population_Total_ts_diff2): p-value
## greater than printed p-value
## 
##  KPSS Test for Level Stationarity
## 
## data:  Electric_Vehicle_Population_Total_ts_diff2
## KPSS Level = 0.30392, Truncation lag parameter = 3, p-value = 0.1
adf.test(Electric_Vehicle_Population_Total_ts_diff2)
## Warning in adf.test(Electric_Vehicle_Population_Total_ts_diff2): p-value
## smaller than printed p-value
## 
##  Augmented Dickey-Fuller Test
## 
## data:  Electric_Vehicle_Population_Total_ts_diff2
## Dickey-Fuller = -5.6299, Lag order = 4, p-value = 0.01
## alternative hypothesis: stationary

We now know that the d part in ARIMA (p,d,q) is 2. Now let’s find p and q

acf(Electric_Vehicle_Population_Total_ts_diff2, lag.max=20)

Acf(Electric_Vehicle_Population_Total_ts_diff2, lag.max=20)

Plot a correlogram

Acf(Electric_Vehicle_Population_Total_ts_diff2, lag.max=20)

Acf(Electric_Vehicle_Population_Total_ts_diff2, lag.max=20, plot=FALSE)
## 
## Autocorrelations of series 'Electric_Vehicle_Population_Total_ts_diff2', by lag
## 
##      0      1      2      3      4      5      6      7      8      9     10 
##  1.000 -0.414 -0.238  0.408 -0.176 -0.149  0.340 -0.125 -0.250  0.362 -0.059 
##     11     12     13     14     15     16     17     18     19     20 
## -0.295  0.386 -0.115 -0.202  0.313 -0.095 -0.215  0.270 -0.028 -0.285

Plot a partial correlogram

Pacf(Electric_Vehicle_Population_Total_ts_diff2, lag.max=20)

Pacf(Electric_Vehicle_Population_Total_ts_diff2, lag.max=20, plot=FALSE)
## 
## Partial autocorrelations of series 'Electric_Vehicle_Population_Total_ts_diff2', by lag
## 
##      1      2      3      4      5      6      7      8      9     10     11 
## -0.414 -0.494  0.090 -0.013 -0.088  0.176  0.131 -0.145  0.082  0.115 -0.113 
##     12     13     14     15     16     17     18     19     20 
##  0.121  0.018  0.010  0.075  0.017 -0.050 -0.006  0.006 -0.132

Auto ARIMA, BIC and AIC

Based on auto.arima function, the best model is ARIMA (2,2,0) (1,0,0) [12]. The AIC value is 1191.86 and BIC value is 1201.29.

auto_fit <- auto.arima(Electric_Vehicle_Population_Total_ts, approximation = FALSE, stepwise = FALSE, trace = TRUE)
## 
##  ARIMA(0,2,0)                               : 1229.067
##  ARIMA(0,2,0)(0,0,1)[12]                    : 1220.337
##  ARIMA(0,2,0)(0,0,2)[12]                    : 1216.092
##  ARIMA(0,2,0)(1,0,0)[12]                    : 1214.323
##  ARIMA(0,2,0)(1,0,1)[12]                    : Inf
##  ARIMA(0,2,0)(1,0,2)[12]                    : Inf
##  ARIMA(0,2,0)(2,0,0)[12]                    : 1214.612
##  ARIMA(0,2,0)(2,0,1)[12]                    : Inf
##  ARIMA(0,2,0)(2,0,2)[12]                    : Inf
##  ARIMA(0,2,1)                               : 1205.252
##  ARIMA(0,2,1)(0,0,1)[12]                    : 1199.25
##  ARIMA(0,2,1)(0,0,2)[12]                    : 1194.864
##  ARIMA(0,2,1)(1,0,0)[12]                    : 1194.567
##  ARIMA(0,2,1)(1,0,1)[12]                    : 1194.865
##  ARIMA(0,2,1)(1,0,2)[12]                    : 1197.103
##  ARIMA(0,2,1)(2,0,0)[12]                    : 1194.505
##  ARIMA(0,2,1)(2,0,1)[12]                    : 1196.38
##  ARIMA(0,2,1)(2,0,2)[12]                    : 1198.69
##  ARIMA(0,2,2)                               : 1204.55
##  ARIMA(0,2,2)(0,0,1)[12]                    : 1200.12
##  ARIMA(0,2,2)(0,0,2)[12]                    : 1196.339
##  ARIMA(0,2,2)(1,0,0)[12]                    : 1196.18
##  ARIMA(0,2,2)(1,0,1)[12]                    : 1196.59
##  ARIMA(0,2,2)(1,0,2)[12]                    : 1198.92
##  ARIMA(0,2,2)(2,0,0)[12]                    : 1196.192
##  ARIMA(0,2,2)(2,0,1)[12]                    : 1197.983
##  ARIMA(0,2,3)                               : 1201.069
##  ARIMA(0,2,3)(0,0,1)[12]                    : 1197.845
##  ARIMA(0,2,3)(0,0,2)[12]                    : 1196.766
##  ARIMA(0,2,3)(1,0,0)[12]                    : 1195.469
##  ARIMA(0,2,3)(1,0,1)[12]                    : 1196.219
##  ARIMA(0,2,3)(2,0,0)[12]                    : 1196.315
##  ARIMA(0,2,4)                               : 1202.199
##  ARIMA(0,2,4)(0,0,1)[12]                    : 1199.753
##  ARIMA(0,2,4)(1,0,0)[12]                    : 1197.688
##  ARIMA(0,2,5)                               : 1203.513
##  ARIMA(1,2,0)                               : 1216.036
##  ARIMA(1,2,0)(0,0,1)[12]                    : 1208.277
##  ARIMA(1,2,0)(0,0,2)[12]                    : 1202.341
##  ARIMA(1,2,0)(1,0,0)[12]                    : 1202.311
##  ARIMA(1,2,0)(1,0,1)[12]                    : 1202.658
##  ARIMA(1,2,0)(1,0,2)[12]                    : Inf
##  ARIMA(1,2,0)(2,0,0)[12]                    : 1202.186
##  ARIMA(1,2,0)(2,0,1)[12]                    : 1203.704
##  ARIMA(1,2,0)(2,0,2)[12]                    : 1206.044
##  ARIMA(1,2,1)                               : 1206.448
##  ARIMA(1,2,1)(0,0,1)[12]                    : 1200.93
##  ARIMA(1,2,1)(0,0,2)[12]                    : 1196.666
##  ARIMA(1,2,1)(1,0,0)[12]                    : 1196.476
##  ARIMA(1,2,1)(1,0,1)[12]                    : 1196.852
##  ARIMA(1,2,1)(1,0,2)[12]                    : Inf
##  ARIMA(1,2,1)(2,0,0)[12]                    : 1196.451
##  ARIMA(1,2,1)(2,0,1)[12]                    : 1198.294
##  ARIMA(1,2,2)                               : 1203.532
##  ARIMA(1,2,2)(0,0,1)[12]                    : 1199.261
##  ARIMA(1,2,2)(0,0,2)[12]                    : 1197.133
##  ARIMA(1,2,2)(1,0,0)[12]                    : 1196.038
##  ARIMA(1,2,2)(1,0,1)[12]                    : Inf
##  ARIMA(1,2,2)(2,0,0)[12]                    : Inf
##  ARIMA(1,2,3)                               : 1202.229
##  ARIMA(1,2,3)(0,0,1)[12]                    : 1199.598
##  ARIMA(1,2,3)(1,0,0)[12]                    : 1197.536
##  ARIMA(1,2,4)                               : 1204.382
##  ARIMA(2,2,0)                               : 1195.062
##  ARIMA(2,2,0)(0,0,1)[12]                    : 1193.853
##  ARIMA(2,2,0)(0,0,2)[12]                    : 1193.337
##  ARIMA(2,2,0)(1,0,0)[12]                    : 1192.409
##  ARIMA(2,2,0)(1,0,1)[12]                    : 1193.507
##  ARIMA(2,2,0)(1,0,2)[12]                    : Inf
##  ARIMA(2,2,0)(2,0,0)[12]                    : 1193.398
##  ARIMA(2,2,0)(2,0,1)[12]                    : 1195.189
##  ARIMA(2,2,1)                               : 1196.847
##  ARIMA(2,2,1)(0,0,1)[12]                    : 1195.955
##  ARIMA(2,2,1)(0,0,2)[12]                    : 1195.672
##  ARIMA(2,2,1)(1,0,0)[12]                    : 1194.654
##  ARIMA(2,2,1)(1,0,1)[12]                    : 1195.854
##  ARIMA(2,2,1)(2,0,0)[12]                    : 1195.748
##  ARIMA(2,2,2)                               : 1198.8
##  ARIMA(2,2,2)(0,0,1)[12]                    : 1198.274
##  ARIMA(2,2,2)(1,0,0)[12]                    : 1197
##  ARIMA(2,2,3)                    : Inf
##  ARIMA(3,2,0)                               : 1196.761
##  ARIMA(3,2,0)(0,0,1)[12]                    : 1195.946
##  ARIMA(3,2,0)(0,0,2)[12]                    : 1195.673
##  ARIMA(3,2,0)(1,0,0)[12]                    : 1194.657
##  ARIMA(3,2,0)(1,0,1)[12]                    : 1195.854
##  ARIMA(3,2,0)(2,0,0)[12]                    : Inf
##  ARIMA(3,2,1)                    : Inf
##  ARIMA(3,2,1)(0,0,1)[12]                    : 1196.414
##  ARIMA(3,2,1)(1,0,0)[12]                    : 1197.003
##  ARIMA(3,2,2)                    : Inf
##  ARIMA(4,2,0)                               : 1198.972
##  ARIMA(4,2,0)(0,0,1)[12]                    : 1198.296
##  ARIMA(4,2,0)(1,0,0)[12]                    : 1196.978
##  ARIMA(4,2,1)                               : 1198.654
##  ARIMA(5,2,0)                               : 1200.745
## 
## 
## 
##  Best model: ARIMA(2,2,0)(1,0,0)[12]
auto_fit
## Series: Electric_Vehicle_Population_Total_ts 
## ARIMA(2,2,0)(1,0,0)[12] 
## 
## Coefficients:
##           ar1      ar2    sar1
##       -0.6136  -0.4319  0.3014
## s.e.   0.1113   0.1167  0.1322
## 
## sigma^2 = 232459:  log likelihood = -591.93
## AIC=1191.86   AICc=1192.41   BIC=1201.29
attributes(auto_fit)
## $names
##  [1] "coef"      "sigma2"    "var.coef"  "mask"      "loglik"    "aic"      
##  [7] "arma"      "residuals" "call"      "series"    "code"      "n.cond"   
## [13] "nobs"      "model"     "bic"       "aicc"      "x"         "fitted"   
## 
## $class
## [1] "forecast_ARIMA" "ARIMA"          "Arima"

Use arima and pass the values

The value (2,2,0) is the non-seasonal part of the ARIMA model. The value (1,0,0) is the seasonal part of the ARIMA model. Since this time series does not indicate any seasonality, the value (1,0,0) cannot be used and returns an error.

Electric_Vehicle_Population_Total_ts_arima <- arima(Electric_Vehicle_Population_Total_ts, order=c(2,2,0))
Electric_Vehicle_Population_Total_ts_arima
## 
## Call:
## arima(x = Electric_Vehicle_Population_Total_ts, order = c(2, 2, 0))
## 
## Coefficients:
##           ar1      ar2
##       -0.6651  -0.5254
## s.e.   0.1017   0.1000
## 
## sigma^2 estimated as 240715:  log likelihood = -594.37,  aic = 1194.74
fit_Arima <- Arima(Electric_Vehicle_Population_Total_ts, order=c(2,2,0))
fit_Arima
## Series: Electric_Vehicle_Population_Total_ts 
## ARIMA(2,2,0) 
## 
## Coefficients:
##           ar1      ar2
##       -0.6651  -0.5254
## s.e.   0.1017   0.1000
## 
## sigma^2 = 247062:  log likelihood = -594.37
## AIC=1194.74   AICc=1195.06   BIC=1201.81

Forecast with different confidence intervals and different forecasting time periods

The plot on the forecast shows the upward trend for the next 5 months or 12 months. It is a good model based on the plot.

forecast(fit_Arima, h=5, level = c(99.5))
##          Point Forecast  Lo 99.5  Hi 99.5
## Sep 2023       155171.9 153776.6 156567.1
## Oct 2023       159624.9 157297.7 161952.1
## Nov 2023       164751.4 161539.4 167963.5
## Dec 2023       169554.5 165069.6 174039.4
## Jan 2024       174218.8 168384.7 180053.0
forecast(fit_Arima, h=5, level = c(95))
##          Point Forecast    Lo 95    Hi 95
## Sep 2023       155171.9 154197.6 156146.1
## Oct 2023       159624.9 158000.0 161249.8
## Nov 2023       164751.4 162508.7 166994.2
## Dec 2023       169554.5 166423.0 172686.0
## Jan 2024       174218.8 170145.2 178292.4
forecast(fit_Arima, h=12, level = c(99.5))
##          Point Forecast  Lo 99.5  Hi 99.5
## Sep 2023       155171.9 153776.6 156567.1
## Oct 2023       159624.9 157297.7 161952.1
## Nov 2023       164751.4 161539.4 167963.5
## Dec 2023       169554.5 165069.6 174039.4
## Jan 2024       174218.8 168384.7 180053.0
## Feb 2024       179145.4 171930.1 186360.7
## Mar 2024       183970.4 175201.8 192739.0
## Apr 2024       188725.2 178311.4 199138.9
## May 2024       193580.0 181458.7 205701.3
## Jun 2024       198405.2 184469.7 212340.7
## Jul 2024       203197.6 187364.5 219030.7
## Aug 2024       208027.4 190228.0 225826.7
forecast(fit_Arima, h=12, level = c(95))
##          Point Forecast    Lo 95    Hi 95
## Sep 2023       155171.9 154197.6 156146.1
## Oct 2023       159624.9 158000.0 161249.8
## Nov 2023       164751.4 162508.7 166994.2
## Dec 2023       169554.5 166423.0 172686.0
## Jan 2024       174218.8 170145.2 178292.4
## Feb 2024       179145.4 174107.4 184183.3
## Mar 2024       183970.4 177847.8 190093.0
## Apr 2024       188725.2 181454.0 195996.4
## May 2024       193580.0 185116.5 202043.5
## Jun 2024       198405.2 188675.0 208135.5
## Jul 2024       203197.6 192142.4 214252.8
## Aug 2024       208027.4 195599.3 220455.5
forecast(fit_Arima, h=5)
##          Point Forecast    Lo 80    Hi 80    Lo 95    Hi 95
## Sep 2023       155171.9 154534.9 155808.9 154197.6 156146.1
## Oct 2023       159624.9 158562.4 160687.4 158000.0 161249.8
## Nov 2023       164751.4 163285.0 166217.9 162508.7 166994.2
## Dec 2023       169554.5 167506.9 171602.1 166423.0 172686.0
## Jan 2024       174218.8 171555.2 176882.4 170145.2 178292.4
forecast(fit_Arima, h=12)
##          Point Forecast    Lo 80    Hi 80    Lo 95    Hi 95
## Sep 2023       155171.9 154534.9 155808.9 154197.6 156146.1
## Oct 2023       159624.9 158562.4 160687.4 158000.0 161249.8
## Nov 2023       164751.4 163285.0 166217.9 162508.7 166994.2
## Dec 2023       169554.5 167506.9 171602.1 166423.0 172686.0
## Jan 2024       174218.8 171555.2 176882.4 170145.2 178292.4
## Feb 2024       179145.4 175851.2 182439.5 174107.4 184183.3
## Mar 2024       183970.4 179967.1 187973.7 177847.8 190093.0
## Apr 2024       188725.2 183970.8 193479.6 181454.0 195996.4
## May 2024       193580.0 188046.0 199114.0 185116.5 202043.5
## Jun 2024       198405.2 192043.0 204767.5 188675.0 208135.5
## Jul 2024       203197.6 195969.0 210426.2 192142.4 214252.8
## Aug 2024       208027.4 199901.1 216153.6 195599.3 220455.5
plot(forecast(fit_Arima, h=5))

plot(forecast(fit_Arima, h=12))

Residual analysis for ARIMA forecast model

The Acf plot for residuals shows that the residuals are not significant hence random. This histogram of the residuals looks like a normal curve where the most values for redisuals are centered around 0.

Acf(fit_Arima$residuals)

Box.test(residuals(fit_Arima), lag=20, type="Ljung")
## 
##  Box-Ljung test
## 
## data:  residuals(fit_Arima)
## X-squared = 11.641, df = 20, p-value = 0.9279
plot.ts(residuals(fit_Arima))

hist(fit_Arima$residuals)

tsdiag(fit_Arima)

Accuracy for ARIMA forecast model

The MAPE of ARIMA forecast model is 0.5321711, which is pretty low. However, among all other forecasting models used to forecast this time series, Moving Average with order 3 still shows the lowest MAPE, 0.2403089. ARIMA is the second best forecasting model as compared to the remaining forecast modes.

accuracy (fit_Arima)
##                   ME     RMSE      MAE       MPE      MAPE       MASE
## Training set 113.645 484.4677 340.4416 0.1298684 0.5321711 0.01894405
##                     ACF1
## Training set -0.01457105